<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<link href="<?php echo $this->baseUrl;?>/admincss/style.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->baseUrl;?>/admincss/thickbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
var baseUrl = "<?php echo $this->baseUrl;?>";
</script>

<script language="javascript" type="text/javascript" src="<?php echo $this->baseUrl;?>/adminjs/jquery.pack.js" /></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseUrl;?>/adminjs/thickbox.compressed.js" /></script>
<body>
<table width="100%" border="1" class="tableA">
    <tr>
    <td colspan="8"><form method="post" action="<?php echo $this->url($this->baseUrl, "news", "list",'', "admin");?>">
    <input type="hidden" name="cid" value="<?php echo $this->cid;?>" />
    <input name="query" type="text" id="query" size="30" value="<?php echo htmlspecialchars($this->query);?>" />
    <input type="submit" name="button" id="button" value="搜索" class="btn_submit"/>
    </form></td>
    </tr>
  <tr>
    <td width="30" nowrap>编号</td>
    <td width="30" nowrap="nowrap">发布人</td>
    <td>标题</td>
    <td width="30">作者</td>
    <td width="30" nowrap>发布时间</td>
    <td width="30">排序</td>
    <td width="30">操作</td>
  </tr>
<?php
foreach ($this->list as $v){
$editurl = $this->url($this->fullUrl, 'news', 'add','aid='.$v['aid'] . '&nowp=' . $this->nowp . '&cid=' . $this->cid);
$delurl=$this->url($this->fullUrl, 'news', 'del', 'aid='.$v['aid'] . '&nowp=' . $this->nowp . '&cid=' . $this->cid);
if (!empty($this->query))
	$delurl .= '&query=' . urlencode($this->query);

$title = addslashes(htmlspecialchars($v['title']));
$editpri = '';
$v['pubtime'] = substr($v['pubtime'], 0, 10);
print <<<EOT
  <tr>
    <td nowrap>{$v['aid']}</td>
    <td nowrap>{$v['username']}</td>
    <td nowrap>{$v['title']}</td>
    <td nowrap>{$v['author']}</td>
    <td nowrap>{$v['pubtime']}</td>
    <td nowrap>{$v['seq']}</td>
    <td nowrap><a href="{$editurl}" {$editpri}>编辑</a> <a href="{$delurl}" onclick="return window.confirm('确认删除:{$title}');">删除</a>
    </td>
  </tr>
EOT;
}
$extparam = "&cid=" . $this->cid;
if (!empty($this->query))
	$extparam .= "&query=" . urlencode($this->query);

$indexurl =$this->url($this->fullUrl, 'news', 'list', 'nowp=1' . $extparam);
$nexturl = $this->url($this->fullUrl, 'news', 'list', 'nowp='.$this->page['next']  . $extparam);
$preurl = $this->url($this->fullUrl, 'news', 'list', 'nowp='.$this->page['previous']  . $extparam);
$lasturl = $this->url($this->fullUrl, 'news', 'list', 'nowp='.$this->page['totalpage']  . $extparam);
print <<<EOT
  <tr>
    <td colspan="7">共{$this->page['totalnum']}篇 {$this->page['nowp']}/{$this->page ['totalpage']}
<a href="{$indexurl}">首页</a>
<a href="{$nexturl}">下一页</a>
EOT;
foreach ($this->pagenum as $v) {
    $url =$this->url($this->fullUrl, 'news', 'list', 'nowp=' . $v . $extparam);
    if ($v == $this->page['nowp'])
        echo $v;
    else
        echo '&nbsp;<a href="' . $url . '">' . $v . '</a>&nbsp;';
}
print <<<EOT
<a href="{$preurl}">前一页</a>
<a href="{$lasturl}">末页</a></td>
  </tr>
EOT;
?>
</table>
<div id="myOnPageContent" style="display:none">
<div align="center" id="myOnPageContent_div">操作成功</div>
</div>
</body>
</html>
